﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="user_new.aspx.cs" Inherits="AnyOffice.general.system.user.user_new" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
    <title>添加用户</title>
    <script src="/aspnet_client/core/function.js"></script>
    <script>
        function CheckForm() {
            if (document.Form1.txtUserId.value == "") {
                alert("用户名不能为空！");
                document.Form1.txtUserId.focus();
                return (false);
            }

            if (document.Form1.txtUserName.value == "") {
                alert("姓名不能为空！");
                document.Form1.txtUserName.focus();
                return (false);
            }

            if (document.Form1.ddlSex.value == "") {
                alert("请选择性别！");
                document.Form1.ddlSex.focus();
                return (false);
            }

            if (document.Form1.ddlDeptId.value == "") {
                alert("请选择部门！");
                return (false);
            }

            if (document.Form1.txtPassword.value != document.Form1.txtPassword2.value) {
                alert("密码与确认密码不匹配！");
                return (false);
            }

            if (!checkIsInteger(document.Form1.txtUserNo.value) || document.Form1.txtUserNo.value == "") {
                alert("用户排序号不能为空，且必须为整数！");
                document.Form1.txtUserNo.focus();
                return (false);
            }

            if (document.Form1.ddlUserPriv.value == "") {
                alert("请选择角色！");
                return (false);
            }

            if ((document.Form1.ddlPostPriv.value == "2") && (document.Form1.ToId.value == "")) {
                alert("请选择管理范围（部门）！");
                return (false);
            }

            if (!checkIsInteger(document.Form1.txtEmailCapacity.value) || document.Form1.txtEmailCapacity.value == "") {
                alert("内部邮箱容量不能为空，且必须为整数！");
                document.Form1.txtEmailCapacity.focus();
                return (false);
            }

            if (!checkIsInteger(document.Form1.txtFolderCapacity.value) || document.Form1.txtFolderCapacity.value == "") {
                alert("我的文件柜容量不能为空，且必须为整数！");
                document.Form1.txtFolderCapacity.focus();
                return (false);
            }

            if (document.Form1.txtUserId.value == document.Form1.txtUserId2.value) {
                alert("用户名和别名不能相同！");
                return (false);
            }

            return true;
        }

        function select_dept() {
            if (document.getElementById("ddlPostPriv").value == "2")
                document.getElementById("postdept_select").style.display = '';
            else
                document.getElementById("postdept_select").style.display = "none";
        }

        function CheckDate(op) {
            mon = document.Form1.ddlBirthday_Mon.value;
            year = document.Form1.ddlBirthday_Year.value;

            if (mon == "4" || mon == "6" || mon == "9" || mon == "11") {
                if (document.Form1.ddlBirthday_Day.options.length > 30)
                    document.Form1.ddlBirthday_Day.remove(30);
                else if (document.Form1.ddlBirthday_Day.options.length < 30) {
                    if (document.Form1.ddlBirthday_Day.options.length == 28) {
                        var my_option = document.createElement("OPTION");
                        my_option.text = "29";
                        my_option.value = "29";
                        document.Form1.ddlBirthday_Day.add(my_option);
                    }

                    var my_option = document.createElement("OPTION");
                    my_option.text = "30";
                    my_option.value = "30";
                    document.Form1.ddlBirthday_Day.add(my_option);
                }
            }

            else if (mon == "2") {
                document.Form1.ddlBirthday_Day.remove(30);
                document.Form1.ddlBirthday_Day.remove(29);

                if (document.Form1.ddlBirthday_Day.options.length > 28)
                    if (!(year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)))
                        document.Form1.ddlBirthday_Day.remove(28);

                if (document.Form1.ddlBirthday_Day.options.length < 29)
                    if ((year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))) {
                        var my_option = document.createElement("OPTION");
                        my_option.text = "29";
                        my_option.value = "29";
                        document.Form1.ddlBirthday_Day.add(my_option);
                    }
            }
            else {
                if (document.Form1.ddlBirthday_Day.options.length < 31) {
                    if (document.Form1.ddlBirthday_Day.options.length == 28) {
                        var my_option = document.createElement("OPTION");
                        my_option.text = "29";
                        my_option.value = "29";
                        document.Form1.ddlBirthday_Day.add(my_option);
                    }

                    if (document.Form1.ddlBirthday_Day.options.length == 29) {
                        var my_option = document.createElement("OPTION");
                        my_option.text = "30";
                        my_option.value = "30";
                        document.Form1.ddlBirthday_Day.add(my_option);
                    }

                    var my_option = document.createElement("OPTION");
                    my_option.text = "31";
                    my_option.value = "31";
                    document.Form1.ddlBirthday_Day.add(my_option);
                }
            }
        }
    </script>
</head>
<body class="bodycolor" topmargin="5">
    <form id="Form1" method="post" runat="server">
    <asp:Panel ID="pnlMain" runat="server">
        <table class="small" cellspacing="0" cellpadding="3" width="100%" border="0">
            <tr>
                <td class="Big">
                    <img height="18" src="/images/notify_new.gif" width="18" align="absMiddle"><span
                        class="big3"> 添加用户</span>
                </td>
            </tr>
        </table>
        <table class="small" cellspacing="1" cellpadding="3" width="90%" align="center" bgcolor="#000000"
            border="0">
            <tr>
                <td class="TableHeader" nowrap colspan="2">
                    <img src="/images/green_arrow.gif" align="absMiddle">
                    以下选项由管理员设置：
                </td>
            </tr>
            <tr>
                <td class="TableData" nowrap>
                    用户名：
                </td>
                <td class="TableData" nowrap>
                    <asp:TextBox ID="txtUserId" runat="server" Columns="15" MaxLength="20" CssClass="BigInput"></asp:TextBox>
                    <asp:Label ID="lblError" runat="server" ForeColor="Red"></asp:Label>
                </td>
            </tr>
            <tr>
                <td class="TableData" nowrap>
                    真实姓名：
                </td>
                <td class="TableData" nowrap>
                    <asp:TextBox ID="txtUserName" runat="server" Columns="15" MaxLength="20" CssClass="BigInput"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="TableData" nowrap>
                    所属：
                </td>
                <td class="TableData" nowrap>
                    <asp:DropDownList ID="ddlDeptId" runat="server" CssClass="BigSelect">
                    </asp:DropDownList>
                    <br>
                    如设置为离校人员/外部人员，将对其他用户不可见
                </td>
            </tr>
            <tr>
                <td class="TableData" nowrap>
                    用户排序号：
                </td>
                <td class="TableData" nowrap>
                    <asp:TextBox ID="txtUserNo" runat="server" Columns="6" MaxLength="4" CssClass="BigInput">10</asp:TextBox>&nbsp;用于同角色用户的排序
                </td>
            </tr>
            <tr>
                <td class="TableData" nowrap>
                    角色：
                </td>
                <td class="TableData" nowrap>
                    <asp:DropDownList ID="ddlUserPriv" runat="server" CssClass="BigSelect">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="TableData" width="120">
                    管理范围（如果有权限执行管理型模块）：
                </td>
                <td class="TableData" nowrap>
                    <select class="BigSelect" id="ddlPostPriv" onchange="select_dept();" name="ddlPostPriv"
                        runat="server">
                        <option value="0" selected>本部门</option>
                        <option value="1">全体</option>
                        <option value="2">指定部门</option>
                    </select>
                </td>
            </tr>
            <tr id="postdept_select" style="display: none">
                <td class="TableData" nowrap>
                    管理范围（部门）：
                </td>
                <td class="TableData">
                    <input id="ToId" type="hidden" name="ToId" runat="server">
                    <textarea class="BigStatic" id="ToName" name="ToName" rows="3" readonly cols="40"
                        runat="server"></textarea>&nbsp;<input class="SmallButton" title="添加部门" onclick="dept_select('ToId','ToName','true');"
                            type="button" value="添 加" name="button">
                    &nbsp;<input class="SmallButton" title="清空部门" onclick="clear_double('ToId','ToName');"
                        type="button" value="清 空" name="button">
                </td>
            </tr>
            <!--<tr>
                <td class="TableData" nowrap>
                    访问控制：
                </td>
                <td class="TableData">
                    <asp:CheckBox ID="ckbUsingKey" runat="server" Text="使用USB KEY登录" />
                </td>
            </tr>
            <tr>
                <td class="TableData" nowrap>
                    考勤排班类型：
                </td>
                <td class="TableData">
                    <asp:DropDownList ID="ddlDutyTypeId" runat="server" DataValueField="DutyTypeId" DataTextField="DutyName"
                        CssClass="BigSelect">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="TableData" nowrap>
                    考勤卡号：
                </td>
                <td class="TableData" nowrap>
                    <asp:TextBox ID="txtAttendCard" runat="server" Columns="20" MaxLength="50" CssClass="BigInput"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="TableData" nowrap>
                    内部邮箱容量：
                </td>
                <td class="TableData">
                    <asp:TextBox ID="txtEmailCapacity" runat="server" Columns="6" MaxLength="4" CssClass="BigInput">100</asp:TextBox>MB
                    为0则表示不限制大小
                </td>
            </tr>
            <tr>
                <td class="TableData" nowrap>
                    我的文件柜容量：
                </td>
                <td class="TableData">
                    <asp:TextBox ID="txtFolderCapacity" runat="server" Columns="6" MaxLength="4" CssClass="BigInput">100</asp:TextBox>MB
                    为0则表示不限制大小
                </td>
            </tr>
            <tr>
                <td class="TableData" nowrap>
                    绑定IP地址：
                </td>
                <td class="TableData">
                    <asp:TextBox ID="txtBindIp" runat="server" Columns="30" TextMode="MultiLine"></asp:TextBox>
                    为空则该用户不绑定固定的IP地址，多个IP地址以,分隔
                </td>
            </tr>-->
            <tr>
                <td class="TableHeader" nowrap colspan="2">
                    <img src="/images/green_arrow.gif" align="absMiddle">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="TableData" nowrap>
                    别名：
                </td>
                <td class="TableData">
                    <asp:TextBox ID="txtUserId2" runat="server" Columns="15" MaxLength="20" CssClass="BigInput"></asp:TextBox>
                    <br>
                    用户可用此别名登录系统，别名不能与其他用户的别名或用户名相同
                </td>
            </tr>
            <tr>
                <td class="TableData" nowrap>
                    密码：
                </td>
                <td class="TableData" nowrap>
                    <asp:TextBox ID="txtPassword" runat="server" Columns="15" MaxLength="20" CssClass="BigInput"
                        TextMode="Password"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="TableData" nowrap>
                    确认密码：
                </td>
                <td class="TableData" nowrap>
                    <asp:TextBox ID="txtPassword2" runat="server" Columns="15" MaxLength="20" CssClass="BigInput"
                        TextMode="Password"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="TableData" nowrap>
                    性别：
                </td>
                <td class="TableData" nowrap>
                    <asp:DropDownList ID="ddlSex" runat="server" CssClass="BigSelect">
                        <asp:ListItem Value="true">男</asp:ListItem>
                        <asp:ListItem Value="false">女</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="TableData" nowrap>
                    生日：
                </td>
                <td class="TableData" nowrap>
                    <!-------------- 年 ------------>
                    <select class="BigSelect" id="ddlBirthday_Year" onchange="CheckDate();" name="ddlBirthday_Year"
                        runat="server">
                        <option value="1900" selected>1900</option>
                        <option value="1901">1901</option>
                        <option value="1902">1902</option>
                        <option value="1903">1903</option>
                        <option value="1904">1904</option>
                        <option value="1905">1905</option>
                        <option value="1906">1906</option>
                        <option value="1907">1907</option>
                        <option value="1908">1908</option>
                        <option value="1909">1909</option>
                        <option value="1910">1910</option>
                        <option value="1911">1911</option>
                        <option value="1912">1912</option>
                        <option value="1913">1913</option>
                        <option value="1914">1914</option>
                        <option value="1915">1915</option>
                        <option value="1916">1916</option>
                        <option value="1917">1917</option>
                        <option value="1918">1918</option>
                        <option value="1919">1919</option>
                        <option value="1920">1920</option>
                        <option value="1921">1921</option>
                        <option value="1922">1922</option>
                        <option value="1923">1923</option>
                        <option value="1924">1924</option>
                        <option value="1925">1925</option>
                        <option value="1926">1926</option>
                        <option value="1927">1927</option>
                        <option value="1928">1928</option>
                        <option value="1929">1929</option>
                        <option value="1930">1930</option>
                        <option value="1931">1931</option>
                        <option value="1932">1932</option>
                        <option value="1933">1933</option>
                        <option value="1934">1934</option>
                        <option value="1935">1935</option>
                        <option value="1936">1936</option>
                        <option value="1937">1937</option>
                        <option value="1938">1938</option>
                        <option value="1939">1939</option>
                        <option value="1940">1940</option>
                        <option value="1941">1941</option>
                        <option value="1942">1942</option>
                        <option value="1943">1943</option>
                        <option value="1944">1944</option>
                        <option value="1945">1945</option>
                        <option value="1946">1946</option>
                        <option value="1947">1947</option>
                        <option value="1948">1948</option>
                        <option value="1949">1949</option>
                        <option value="1950">1950</option>
                        <option value="1951">1951</option>
                        <option value="1952">1952</option>
                        <option value="1953">1953</option>
                        <option value="1954">1954</option>
                        <option value="1955">1955</option>
                        <option value="1956">1956</option>
                        <option value="1957">1957</option>
                        <option value="1958">1958</option>
                        <option value="1959">1959</option>
                        <option value="1960">1960</option>
                        <option value="1961">1961</option>
                        <option value="1962">1962</option>
                        <option value="1963">1963</option>
                        <option value="1964">1964</option>
                        <option value="1965">1965</option>
                        <option value="1966">1966</option>
                        <option value="1967">1967</option>
                        <option value="1968">1968</option>
                        <option value="1969">1969</option>
                        <option value="1970">1970</option>
                        <option value="1971">1971</option>
                        <option value="1972">1972</option>
                        <option value="1973">1973</option>
                        <option value="1974">1974</option>
                        <option value="1975">1975</option>
                        <option value="1976">1976</option>
                        <option value="1977">1977</option>
                        <option value="1978">1978</option>
                        <option value="1979">1979</option>
                        <option value="1980">1980</option>
                        <option value="1981">1981</option>
                        <option value="1982">1982</option>
                        <option value="1983">1983</option>
                        <option value="1984">1984</option>
                        <option value="1985">1985</option>
                        <option value="1986">1986</option>
                        <option value="1987">1987</option>
                        <option value="1988">1988</option>
                        <option value="1989">1989</option>
                        <option value="1990">1990</option>
                        <option value="1991">1991</option>
                        <option value="1992">1992</option>
                        <option value="1993">1993</option>
                        <option value="1994">1994</option>
                        <option value="1995">1995</option>
                        <option value="1996">1996</option>
                        <option value="1997">1997</option>
                        <option value="1998">1998</option>
                        <option value="1999">1999</option>
                        <option value="2000">2000</option>
                        <option value="2001">2001</option>
                        <option value="2002">2002</option>
                        <option value="2003">2003</option>
                        <option value="2004">2004</option>
                        <option value="2005">2005</option>
                        <option value="2006">2006</option>
                        <option value="2007">2007</option>
                        <option value="2008">2008</option>
                        <option value="2009">2009</option>
                        <option value="2010">2010</option>
                    </select>年
                    <!-------------- 月 ------------>
                    <select class="BigSelect" id="ddlBirthday_Mon" onchange="CheckDate();" name="ddlBirthday_Mon"
                        runat="server">
                        <option value="1" selected>01</option>
                        <option value="2">02</option>
                        <option value="3">03</option>
                        <option value="4">04</option>
                        <option value="5">05</option>
                        <option value="6">06</option>
                        <option value="7">07</option>
                        <option value="8">08</option>
                        <option value="9">09</option>
                        <option value="10">10</option>
                        <option value="11">11</option>
                        <option value="12">12</option>
                    </select>月
                    <!-------------- 日 ------------>
                    <select class="BigSelect" id="ddlBirthday_Day" name="ddlBirthday_Day" runat="server">
                        <option value="1" selected>01</option>
                        <option value="2">02</option>
                        <option value="3">03</option>
                        <option value="4">04</option>
                        <option value="5">05</option>
                        <option value="6">06</option>
                        <option value="7">07</option>
                        <option value="8">08</option>
                        <option value="9">09</option>
                        <option value="10">10</option>
                        <option value="11">11</option>
                        <option value="12">12</option>
                        <option value="13">13</option>
                        <option value="14">14</option>
                        <option value="15">15</option>
                        <option value="16">16</option>
                        <option value="17">17</option>
                        <option value="18">18</option>
                        <option value="19">19</option>
                        <option value="20">20</option>
                        <option value="21">21</option>
                        <option value="22">22</option>
                        <option value="23">23</option>
                        <option value="24">24</option>
                        <option value="25">25</option>
                        <option value="26">26</option>
                        <option value="27">27</option>
                        <option value="28">28</option>
                        <option value="29">29</option>
                        <option value="30">30</option>
                        <option value="31">31</option>
                    </select>日&nbsp;
                    <asp:CheckBox ID="ckbIsHideBirthday" runat="server" Text="生日不公开"></asp:CheckBox>
                </td>
            </tr>
            <!--<tr>
                <td class="TableData" nowrap>
                    界面主题：
                </td>
                <td class="TableData" nowrap>
                    <asp:DropDownList ID="ddlTheme" runat="server" CssClass="BigSelect" DataValueField="Id"
                        DataTextField="Name">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="TableData" nowrap>
                    手机：
                </td>
                <td class="TableData" nowrap>
                    <asp:TextBox ID="txtMobile" runat="server" MaxLength="50" CssClass="BigInput" Width="200px"></asp:TextBox>
                    <asp:CheckBox ID="ckbIsHideMobile" runat="server" Text="手机号码不公开"></asp:CheckBox><br>
                    填写后可接收OA系统发送的手机短信<br>
                    小灵通请加106及区号，如 106010xxxxxxxx
                </td>
            </tr>-->
            <tr>
                <td class="TableControl" nowrap align="center" colspan="2">
                    <input class="BigButton" onclick="return CheckForm();" type="submit" value="添加">
                </td>
            </tr>
        </table>
        <br>
    </asp:Panel>
    <asp:Literal ID="litUserId2" runat="server"></asp:Literal>
    <asp:Literal ID="litMessage" runat="server"></asp:Literal>
    </form>
</body>
</html>
